package com.itita.weibo.model;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.itita.weibo.ui.R;

/**
 * 更多
 * @author 焦明 2010-5-10 3:40
 *
 */
public final class MoreOperAdapter extends BaseAdapter{
    
	private Context context;
	
	private List<Integer> list;
	
	private LayoutInflater inflater;
	
	public MoreOperAdapter(Context context, List<Integer> list){
		this.context = context;
		this.list = list;
		this.inflater = LayoutInflater.from(context);
	}
	
	@Override
	public int getCount() {
		return this.list.size();
	}

	@Override
	public Object getItem(int position) {
		return this.list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView == null){
			convertView = this.inflater.inflate(R.layout.more_list_item, null);
		}
		
		ImageView ivOperIcon = (ImageView) convertView.findViewById(R.id.ImageView01);
		TextView text = (TextView) convertView.findViewById(R.id.TextView01); 
//		ImageView ivArrow = (ImageView) convertView.findViewById(R.id.imageView);
		
		if(position==0){ 
    		convertView.setBackgroundResource(R.drawable.circle_list_top);
    	}else if(position==(list.size()-1)){
    		convertView.setBackgroundResource(R.drawable.circle_list_bottom);
    	}else{
    		convertView.setBackgroundResource(R.drawable.circle_list_middle);
    	}
		text.setText(list.get(position));
        switch (position) {
			case 0:
				ivOperIcon.setImageResource(R.drawable.moreitems_accountmanage_icon);
				break;
			case 1:
				ivOperIcon.setImageResource(R.drawable.clear_catche_manager);
				break;
			case 2:
				ivOperIcon.setImageResource(R.drawable.moreitems_feedback_icon);
				break;
			case 3:
				ivOperIcon.setImageResource(R.drawable.moreitems_about_icon);
				break;
			default:
				break;
		}    	
        return convertView; 
	}

}
